# _*_ coding:utf-8 _*_
from __future__ import unicode_literals

from datetime import datetime

from django.db import models


# Create your models here.


class Banner(models.Model):
    title = models.CharField(max_length=100, verbose_name=u"标题")
    image = models.ImageField(
        upload_to="banner/%Y/%m",
        verbose_name=u"轮播图",
        max_length=100)
    url = models.URLField(max_length=200, verbose_name=u"访问地址")

    index = models.IntegerField(default=100, verbose_name=u"顺序")
    add_time = models.DateTimeField(default=datetime.now, verbose_name=u"添加时间")

    class Meta:
        verbose_name = u"轮播图"
        verbose_name_plural = verbose_name

    def __unicode__(self):
        return '{0}(位于第{1}位)'.format(self.title, self.index)


class Peugeot(models.Model):
    ROOT = models.TextField(verbose_name=u"公司名", null=True, max_length=50, default="CodePlay")
    Wechat_image = models.ImageField(upload_to="wechat/%Y/%m", null=True, verbose_name=u"微信二维码",
                                     default="wechat/default/code.jpg", max_length=100)
    official_number = models.CharField(verbose_name=u"官方联系电话", null=True, max_length=12, default="1234567890")
    notice = models.TextField(verbose_name=u"官方公告", max_length=50, null=True, default="官网正式上线！")
    logo = models.ImageField(upload_to="logo/%Y/%m", verbose_name=u"官方Logo", max_length=100,
                             default="logo/default/logo.jpg")
    copyright = models.TextField(verbose_name=u"版权", null=True, max_length=50, default="CodePlay All Rights Reserved")
    file_num = models.CharField(verbose_name=u"备案号", null=True, max_length=20, default="123456-4")

    class Meta:
        verbose_name = u"标志性"
        verbose_name_plural = verbose_name


# 栏目
class AddColumns(models.Model):
    Columns = models.TextField(verbose_name=u"新的栏目", max_length=50, null=True, default="")

    class Meta:
        verbose_name = u"添加栏目"
        verbose_name_plural = verbose_name
